from socket import *

tcpSerSock = socket(AF_INET,SOCK_STREAM)
host = "192.168.31.108"
port = 5000
tcpSerSock.bind((host,port))
tcpSerSock.listen(5)
clientSock,clientAddr = tcpSerSock.accept()

while True:
    recvData = clientSock.recv(1024)
    print("接受的数据：%s"%recvData.decode("gb2312"))
    clientSock.send("thank you".encode("gb2312"))

clientSock.close()
tcpSerSock.close()